using System;

namespace Coding4Fun.BluetoothPanoHead
{
    /// <summary>
    /// Helper class that parses pano command sent by the controller
    /// </summary>
    public class PanoSettings
    {
        public int Duration { get; set; }
        public int Settle { get; set; }
        public int Shutter { get; set; }
        public int Pause { get; set; }
        public int Iterations { get; set; }

        public PanoSettings()
        {
            Duration = 150;
            Settle = 1000;
            Shutter = 100;
            Pause = 2000;
            Iterations = 1;
        }

        /// <summary>
        /// Parses the parameters from an array of string
        /// </summary>
        /// <param name="param">The parameters in a string array.</param>
        public void Load(string [] param)
        {
            int i = param.Length;

            if (i > 0)
                Duration = Convert.ToInt32(param[0]);

            if (i > 1)
                Settle = Convert.ToInt32(param[1]);

            if (i > 2)
                Shutter = Convert.ToInt32(param[2]);

            if (i > 3)
                Pause = Convert.ToInt32(param[3]);

            if (i > 4)
                Iterations = Convert.ToInt32(param[4]);
        }
    }
}
